<?php

namespace App\Http\Controllers\Admin\Editor;
use App\Http\Requests\ArticlesPostRequest;
use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    public function getIndex(Request $request)
    {
        $id = $request->session()->get('id');
        $uid = DB::table('hs_relation')->where('eid',$id)->get();
        foreach($uid as $k=>$v){
        	$str = '';
        	$sid = '';
        	$books = DB::table('hs_books')
        		->join('hs_member','hs_member.id','=','hs_books.aid')
        		->where('aid',$v->aid)
        		->select('aid','b_name','hs_member.name')
        		->get();
        	$i = 0;
        	foreach($books as $kk=>$vv){
        		
        		$str .='《'.$vv->b_name.'》';
        		$str .= '';
        		$sid =$vv->aid;
        		$sname =$vv->name;

        		$data[$i]['id'] = $sid;
        		$data[$i]['b_name'] = $str;
        		$data[$i]['name'] = $sname;

        		$i++;
        	}

        }
        // dd($data);	
        // dd($infos);
        return view('admin.editor.user.index',['data'=>$data]);
    }

}
